home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / nids.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-19  |  2.3 KB  |  129 lines

  1. /*
  2.   Copyright (c) 1999 Rafal Wojtczuk <nergal@avet.com.pl>. All rights reserved.
  3.   See the file COPYING for license details.
  4. */
  5.  
  6. #ifndef _NIDS_NIDS_H
  7. #define _NIDS_NIDS_H
  8. #define NIDS_MAJOR 1
  9. #define NIDS_MINOR 18
  10. #include <sys/types.h>
  11. enum
  12. {
  13.   NIDS_WARN_IP = 1,
  14.   NIDS_WARN_TCP,
  15.   NIDS_WARN_UDP,
  16.   NIDS_WARN_SCAN
  17. };
  18.  
  19. enum
  20. {
  21.   NIDS_WARN_UNDEFINED = 0,
  22.   NIDS_WARN_IP_OVERSIZED,
  23.   NIDS_WARN_IP_INVLIST,
  24.   NIDS_WARN_IP_OVERLAP,
  25.   NIDS_WARN_IP_HDR,
  26.   NIDS_WARN_IP_SRR,
  27.   NIDS_WARN_TCP_TOOMUCH,
  28.   NIDS_WARN_TCP_HDR,
  29.   NIDS_WARN_TCP_BIGQUEUE,
  30.   NIDS_WARN_TCP_BADFLAGS
  31. };
  32.  
  33. #define NIDS_JUST_EST 1
  34. #define NIDS_DATA 2
  35. #define NIDS_CLOSE 3
  36. #define NIDS_RESET 4
  37. #define NIDS_TIMED_OUT 5
  38. #define NIDS_EXITING   6    /* nids is exiting; last chance to get data */
  39.  
  40. struct tuple4
  41. {
  42.   u_short source;
  43.   u_short dest;
  44.   u_int saddr;
  45.   u_int daddr;
  46. };
  47.  
  48. struct half_stream
  49. {
  50.   char state;
  51.   char collect;
  52.   char collect_urg;
  53.  
  54.   char *data;
  55.   int offset;
  56.   int count;
  57.   int count_new;
  58.   int bufsize;
  59.   int rmem_alloc;
  60.  
  61.   int urg_count;
  62.   u_int acked;
  63.   u_int seq;
  64.   u_int ack_seq;
  65.   u_int first_data_seq;
  66.   u_char urgdata;
  67.   u_char count_new_urg;
  68.   u_char urg_seen;
  69.   u_int urg_ptr;
  70.   u_short window;
  71.   u_char ts_on;
  72.   u_int curr_ts; 
  73.   struct skbuff *list;
  74.   struct skbuff *listtail;
  75. };
  76.  
  77. struct tcp_stream
  78. {
  79.   struct tuple4 addr;
  80.   char nids_state;
  81.   struct lurker_node *listeners;
  82.   struct half_stream client;
  83.   struct half_stream server;
  84.   struct tcp_stream *next_node;
  85.   struct tcp_stream *prev_node;
  86.   int hash_index;
  87.   struct tcp_stream *next_time;
  88.   struct tcp_stream *prev_time;
  89.   int read;
  90.   struct tcp_stream *next_free;
  91. };
  92.  
  93. struct nids_prm
  94. {
  95.   int n_tcp_streams;
  96.   int n_hosts;
  97.   char *device;
  98.   char *filename;
  99.   int sk_buff_size;
  100.   int dev_addon;
  101.   void (*syslog) ();
  102.   int syslog_level;
  103.   int scan_num_hosts;
  104.   int scan_delay;
  105.   int scan_num_ports;
  106.   void (*no_mem) (char *);
  107.   int (*ip_filter) ();
  108.   char *pcap_filter;
  109.   int promisc;
  110.   int one_loop_less;
  111. };
  112.  
  113. int nids_init ();
  114. void nids_register_ip_frag (void (*));
  115. void nids_register_ip (void (*));
  116. void nids_register_tcp (void (*));
  117. void nids_register_udp (void (*));
  118. void nids_killtcp (struct tcp_stream *);
  119. void nids_discard (struct tcp_stream *, int);
  120. void nids_run ();
  121. int nids_getfd ();
  122. int nids_next ();
  123.  
  124. extern struct nids_prm nids_params;
  125. extern char *nids_warnings[];
  126. extern char nids_errbuf[];
  127.  
  128. #endif /* _NIDS_NIDS_H */
  129.